package com.xiaotao.util;

import lombok.*;

@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
public class ResponseUtil {
    private Integer code;
    private String msg;
    private Object data;

    public ResponseUtil(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public static ResponseUtil get(ResponseEnum responseEnum){
        return new ResponseUtil(responseEnum.getCode(),responseEnum.getMsg());
    }
    public static ResponseUtil get(ResponseEnum responseEnum,Object data){
        return new ResponseUtil(responseEnum.getCode(),responseEnum.getMsg(),data);
    }
    public static ResponseUtil getError(Integer code,String msg){
        return new ResponseUtil(code,msg);
    }
}
